#include "MysqlMgr.hpp"
#include "MysqlDao.hpp"
#include <json/value.h>
#include <vector>

MysqlMgr::MysqlMgr() {}
int MysqlMgr::RegUser(const std::string &name, const std::string &email,
                      const std::string &pwd) {
  return _dao.RegUser(name, email, pwd);
}
bool MysqlMgr::CheckEmail(const std::string &email) {
  return _dao.CheckEmail(email);
}
bool MysqlMgr::UpdatePwd(const std::string &email, const std::string &pwd) {
  return _dao.UpdatePwd(email, pwd);
}
bool MysqlMgr::CheckPwd(const std::string &email, const std::string &pwd,
                        UserInfo &userInfo) {
  return _dao.CheckPwd(email, pwd, userInfo);
}
bool MysqlMgr::AddFriendApply(const FriendApplyInfo &friendApplyInfo) {
  return _dao.AddFriendApply(friendApplyInfo);
}
std::shared_ptr<UserInfo> MysqlMgr::GetUser(int uid) {
  return _dao.GetUser(uid);
}
std::shared_ptr<UserInfo> MysqlMgr::GetUser(std::string name) {
  return _dao.GetUser(name);
}

bool MysqlMgr::GetApplyInfo(int to_uid,
                            std::vector<std::shared_ptr<FriendApplyInfo>> &list,
                            int start, int step) {
  return _dao.GetApplyInfo(to_uid, list, start, step);
}
bool MysqlMgr::MakeFriend(int fromuid, int touid, std::string remark) {
  return _dao.MakeFriend(fromuid, touid, remark);
}

bool MysqlMgr::GetFriends(
    int uid, std::vector<std::shared_ptr<FriendInfo>> &friendList) {
  return _dao.GetFriends(uid, friendList);
}
bool MysqlMgr::SaveMessage(std::shared_ptr<TextMessage> textMessage) {
  return _dao.SaveMessage(textMessage);
}
void MysqlMgr::SureMessage(int touid,
                           const std::vector<std::string> &msg_id_list) {
  return _dao.SureMessage(touid, msg_id_list);
}

void MysqlMgr::LoadMessage(
    int touid, std::vector<std::shared_ptr<TextMessage>> &messageList) {
  return _dao.LoadMessage(touid, messageList);
}
MysqlMgr::~MysqlMgr() {}